home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / hcsvga12.zip / HCMOUSE.C < prev    next >
C/C++ Source or Header  |  1992-11-06  |  1KB  |  81 lines

  1. /*
  2.  * HCMOUSE.C
  3.  *
  4.  * Copyright 1990, Synergrafix Constulting
  5.  *           All rights reserved.
  6.  *
  7.  * Version 1.0
  8.  * Dec. 10 1991
  9.  *
  10.  */
  11.  
  12. #include <stdlib.h>
  13. #include <stdio.h>
  14. #include <conio.h>
  15. #include "hicolor.h"
  16.  
  17. void error(char *s) {
  18.  
  19.     hctextmode();
  20.     printf("%s\n",s);
  21.     exit(1);
  22.     }
  23.  
  24. main() {
  25.  
  26.     int x,y,b,oldx,oldy;
  27.     char str[100];
  28.  
  29.     if (!hcsetmodetseng(HC_SVGAHI,TRUE)) {
  30.         error("Can't set HiColor mode.");
  31.         }
  32.  
  33.     if (!initgrcursor(0,10000)) {
  34.         error("No mouse detected.");
  35.         }
  36.  
  37.         sprintf(str,"Use Left Mouse Button to Draw.");
  38.     hcputstr(str,0,hcgetmaxy()-20,10000,0,0);
  39.     sprintf(str,"Any key to exit.");
  40.     hcputstr(str,0,hcgetmaxy()-10,10000,0,0);
  41.  
  42.     oldx=getgrcursorx(); oldy=getgrcursory();
  43.  
  44.     unputgrcursor();
  45.  
  46.     hcrectanglexor(100,100,oldx,oldy,20000);
  47.  
  48.         putgrcursor(oldx, oldy);
  49.  
  50.     do {
  51.        getmouse(&x, &y, &b);
  52.  
  53.        if ((x != getgrcursorx() ) || (y != getgrcursory() )) {
  54.  
  55.           unputgrcursor();
  56.  
  57.           hcrectanglexor(100,100,oldx,oldy,20000);
  58.  
  59.           if (b==1) {
  60.               hcline(oldx,oldy,x,y,(x+20)*(y+20));
  61.               }
  62.  
  63.           hcrectanglexor(100,100,x,y,20000);
  64.  
  65.           putgrcursor(x, y);
  66.  
  67.           oldx=x; oldy=y;
  68.        }
  69.  
  70.     }  while (!kbhit());
  71.  
  72.     closegrcursor();
  73.  
  74.     getch();
  75.  
  76.     hctextmode();
  77.  
  78.     return 0;
  79.     }
  80.  
  81.